package net.peelmeagrape.hibernate;

import net.peelmeagrape.hibernate.xmlgen.XmlAttribute;
import net.peelmeagrape.hibernate.xmlgen.XmlElement;
import net.peelmeagrape.hibernate.xmlgen.XmlText;

import java.lang.annotation.Retention;
import static java.lang.annotation.RetentionPolicy.RUNTIME;

/**
 * Declares the type of the containing {@link Property} (overrides an eventually existing type
 * attribute of the property). May contain param elements to customize a ParametrizableType.
 */
@Retention(RUNTIME)
@XmlElement(name="type")
public @interface TypeMapping
{
    @XmlAttribute String name();
    Param[] params() default {};

    /**
     * to customize a ParametrizableType.
     */
    @XmlElement(name="param")
    public @interface Param {
        @XmlAttribute String name();
        @XmlText String value();
    }
}
